home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / pp / pp-6.0 / Lib / format / rfc2msgid.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-12-18  |  1.4 KB  |  71 lines

  1. /* rfc2msgid - Converts a RFC string into a MPDUid struct */
  2.  
  3. # ifndef lint
  4. static char Rcsid[] = "@(#)$Header: /xtel/pp/pp-beta/Lib/format/RCS/rfc2msgid.c,v 6.0 1991/12/18 20:22:06 jpo Rel $";
  5. # endif
  6.  
  7. /*
  8.  * $Header: /xtel/pp/pp-beta/Lib/format/RCS/rfc2msgid.c,v 6.0 1991/12/18 20:22:06 jpo Rel $
  9.  *
  10.  * $Log: rfc2msgid.c,v $
  11.  * Revision 6.0  1991/12/18  20:22:06  jpo
  12.  * Release 6.0
  13.  *
  14.  */
  15.  
  16.  
  17.  
  18. #include        "util.h"
  19. #include        "mta.h"
  20. #include     "x400_ub.h"
  21.  
  22.  
  23.  
  24.  
  25. /* ---------------------  Begin  Routines  -------------------------------- */
  26.  
  27.  
  28.  
  29.  
  30. int rfc2msgid (mp, str)
  31. register MPDUid         *mp;
  32. char                    *str;
  33. {
  34.     char            *cp, *start, *end, *temp;
  35.  
  36.     PP_DBG (("Lib/rfc2msgid (%s)", str));
  37.  
  38.     temp = strdup(str);
  39.     start = temp;
  40.     if (*start == '[') {
  41.         start++;
  42.         end = str+strlen(str);
  43.         if (*end == ']')
  44.             *end = '\0';
  45.     }
  46.  
  47.     /* try parsing as dom;string */
  48.     cp = rindex (start, ';');
  49.     if (cp != NULLCP) {
  50.         *cp++ = '\0';
  51.         if (rfc2globalid (&mp->mpduid_DomId, start) == OK) {
  52.             mp->mpduid_string = strdup (cp);
  53.             free(temp);
  54.             return OK;
  55.         }
  56.     }
  57.     free(temp);
  58.     GlobalDomId_free(&mp->mpduid_DomId);
  59.     /* put in loc dom and string */
  60.     if ((int) strlen(str) > UB_LOCAL_ID_LENGTH) {
  61.         char tbuf[UB_LOCAL_ID_LENGTH + 1];
  62.         (void) strncap (tbuf, str, UB_LOCAL_ID_LENGTH);
  63.         tbuf[UB_LOCAL_ID_LENGTH] = 0;
  64.         mp->mpduid_string = strdup (tbuf);
  65.     }
  66.     else
  67.         mp->mpduid_string = strdup (str);
  68.     GlobalDomId_new (&mp->mpduid_DomId);
  69.     return OK;
  70. }
  71.